package com.zoshine.zzg.controller;

import com.zoshine.zzg.annotation.DisableLoginCheck;
import com.zoshine.zzg.base.BaseResponse;
import com.zoshine.zzg.respons.AppResponse;
import com.zoshine.zzg.service.InitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 表及数据初始化控制器
 * @author 贾俊峰
 * @time 2017/8/10 11:37
 */
@RestController
@RequestMapping("init")
public class InitController {
    private InitService initService;
    @Autowired
    public void setInitService(InitService initService) {
        this.initService = initService;
    }

    /**
     * 初始化表结构
     */
    @RequestMapping("table")
    @DisableLoginCheck
    public BaseResponse initTable() {
        initService.initTable();
        return AppResponse.OK;
    }

    /**
     * 初始化表数据
     */
    @RequestMapping("data")
    @DisableLoginCheck
    public BaseResponse initData() {
        initService.initData();
        return AppResponse.OK;
    }

    /**
     * 初始化表结构及数据
     */
    @RequestMapping("tableAndData")
    @DisableLoginCheck
    public BaseResponse initTableAndData() {
        return AppResponse.OK;
    }
}
